import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_note/ui/page/detail/detail_page.dart';
import 'package:flutter_note/ui/page/edit/edit_page.dart';
import 'package:flutter_note/ui/page/home/home_page.dart';
import 'package:flutter_note/weight/page_route_anim.dart';

class RouteName {
  static const String splash = 'splash';
  static const String home = '/';
  static const String edit = 'edit';
  static const String detail = 'detail';
}

class Router {
  static Route<dynamic> generateRouter(RouteSettings settings) {
    switch (settings.name) {
      case RouteName.home:
        return NoAnimRouteBuilder(HomePage());
      case RouteName.edit:
        return SlideLeftRouteBuilder(NoteEditPage(params: settings.arguments));
      case RouteName.detail:
        return SlideLeftRouteBuilder(NoteDetailPage());
      default:
        return CupertinoPageRoute(
            builder: (_) => Scaffold(
                  body: Center(
                    child: Text("No route defined for ${settings.name}"),
                  ),
                ));
    }
  }
}
